package com.aiyige.model.moment.backup;


import android.text.TextUtils;

import java.io.Serializable;

/**
 * 功能: 我的状态. <br/>
 *
 * @author wangzhijun
 * @date 2018-01-15 19:33
 * @since JDK 1.8
 */
public class MineBackup implements Serializable {


    /**
     * 1：点赞过
     */
    private String praiseId;
    /**
     * 1：收藏过
     */
    private String favoriteId;
    /**
     * 1：看过
     */
    private Integer viewed;
    /**
     * 1：评论过
     */
    private Integer commented;
    /**
     * 1：买过（判断用户是否已购买，不能通过单个视频的free字段判断是否免费）
     */
    private Integer buyed;
    /**
     * 有值表示当前用户已关注该创建人，内容是关注ID，可用于取消关注
     */
    private String userFollowId;
    private boolean mutualFollower;

    public MineBackup() {

    }

    public boolean isMutualFollower() {
        return mutualFollower;
    }

    public void setMutualFollower(boolean mutualFollower) {
        this.mutualFollower = mutualFollower;
    }

    public String getFavoriteId() {
        return favoriteId;
    }

    public boolean isViewed() {
        return viewed == 1;
    }

    public String getPraiseId() {
        return praiseId;
    }


    public void setFavoriteId(String favoriteId) {
        this.favoriteId = favoriteId;
    }

    public Integer getViewed() {
        return viewed;
    }

    public void setViewed(Integer viewed) {
        this.viewed = viewed;
    }

    public Integer getCommented() {
        return commented;
    }

    public void setCommented(Integer commented) {
        this.commented = commented;
    }

    public Integer getBuyed() {
        return buyed;
    }

    public void setBuyed(Integer buyed) {
        this.buyed = buyed;
    }

    public String getUserFollowId() {
        return userFollowId;
    }

    public void setUserFollowId(String userFollowId) {
        this.userFollowId = userFollowId;
    }

    public String getPraised() {
        return praiseId;
    }

    public void setPraiseId(String praiseId) {
        this.praiseId = praiseId;
    }

    public boolean isFavorited() {
        return !TextUtils.isEmpty(favoriteId);
    }

    public boolean isPraised() {
        return !TextUtils.isEmpty(praiseId);
    }

    /**
     * 1-买过（判断用户是否已购买，不能通过单个视频的free字段判断是否免费）
     *
     * @return
     */
    public boolean isBuyed() {
        return buyed != null && buyed == 1;
    }

    public MineBackup(MineBackup other) {
        if (other == null) {
            this.praiseId = "";
            this.favoriteId = "";
            this.viewed = 0;
            this.commented = 0;
            this.buyed = 0;
            this.userFollowId = "";
            this.mutualFollower = false;
        } else {
            this.praiseId = other.praiseId == null ? "" : other.praiseId;
            this.favoriteId = other.favoriteId == null ? "" : other.favoriteId;
            this.viewed = other.viewed == null ? 0 : other.viewed;
            this.commented = other.commented == null ? 0 : other.commented;
            this.buyed = other.buyed == null ? 0 : other.buyed;
            this.userFollowId = other.userFollowId == null ? "" : other.userFollowId;
            this.mutualFollower = other.mutualFollower;
        }
    }
}
